package com.itheima.classtest.test01;

import java.util.concurrent.Semaphore;

public class Person implements Runnable {
    private Semaphore semaphore = new Semaphore(3);

    @Override
    public void run() {
        try {
            semaphore.acquire();
            System.out.println("一个游客进去参观");
            Thread.sleep(2000);
            System.out.println("一个游客出来了");
            semaphore.release();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

